home *** CD-ROM | disk | FTP | other *** search
/ Exame Informatica 139 / Exame Informatica 139.iso / Revista / Flash / Uniform Server / diskw / home / admin / www / phpMyAdmin / footer.inc.php < prev    next >
Encoding:
PHP Script  |  2005-08-12  |  8.2 KB  |  196 lines

  1. <?php
  2. /* $Id: footer.inc.php,v 2.17 2005/08/12 13:14:06 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5. /**
  6.  * WARNING: This script has to be included at the very end of your code because
  7.  *          it will stop the script execution!
  8.  */
  9.  
  10. require_once('./libraries/relation.lib.php'); // for PMA_setHistory()
  11.  
  12. /**
  13.  * Query window
  14.  */
  15.  
  16. // If query window is wanted and open, update with latest selected db/table.
  17. if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
  18. ?>
  19.  
  20. <script type="text/javascript">
  21. <!--
  22. <?php
  23.     if (!isset($no_history) && !empty($db) && (!isset($error_message) || $error_message == '')) {
  24.         $tables              = PMA_DBI_try_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
  25.         $num_tables          = ($tables) ? @PMA_DBI_num_rows($tables) : 0;
  26.         $common_url_query    = PMA_generate_common_url($db);
  27.         // if we put a space before the left bracket, it causes a display
  28.         // problem in IE
  29.         if ($num_tables) {
  30.             $num_tables_disp = '(' . $num_tables . ')';
  31.         } else {
  32.             $num_tables_disp = '(-)';
  33.         }
  34.     ?>
  35.     var forceQueryFrameReload = false;
  36. <?php
  37.     // $is_drop_database comes from sql.php when we saw a DROP DATABASE
  38.     // $force_queryframe_reload comes from db_operations.php
  39.     if ((isset($is_drop_database) && $is_drop_database) || (isset($force_queryframe_reload) && $force_queryframe_reload == TRUE)) {
  40. ?>
  41.     forceQueryFrameReload = true;
  42. <?php
  43.     }
  44. ?>
  45.     var dbBoxSetupDone = false;
  46.     function dbBoxSetup() {
  47.         if (dbBoxSetupDone != true) {
  48.             if (parent.frames.queryframe && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
  49.                 parent.frames.queryframe.document.left.lightm_db.value = '<?php echo addslashes($db); ?>';
  50.                 dbBoxSetupDone = true;
  51.             } else {
  52.                 setTimeout("dbBoxSetup();",500);
  53.             }
  54.         }
  55.     }
  56.     if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.queryframeform) {
  57.         parent.frames.queryframe.document.queryframeform.db.value = "<?php echo (isset($db) ? addslashes($db) : ''); ?>";
  58.         parent.frames.queryframe.document.queryframeform.table.value = "<?php echo (isset($table) ? addslashes($table) : ''); ?>";
  59.     }
  60.     if (parent.frames.queryframe && parent.frames.queryframe.document && parent.frames.queryframe.document.left && parent.frames.queryframe.document.left.lightm_db) {
  61.         selidx = parent.frames.queryframe.document.left.lightm_db.selectedIndex;
  62.         if (parent.frames.queryframe.document.left.lightm_db.options[selidx].value == "<?php echo addslashes($db); ?>" && forceQueryFrameReload == false) {
  63.             parent.frames.queryframe.document.left.lightm_db.options[selidx].text =
  64.                 parent.frames.queryframe.document.left.lightm_db.options[selidx].text.replace(/(.*)\([0-9]+\)/,'$1<?php echo $num_tables_disp;?>');
  65.         } else {
  66.             parent.frames.queryframe.location.reload();
  67.             setTimeout("dbBoxSetup();",2000);
  68.         }
  69.     }
  70.     <?php
  71.     }
  72.     ?>
  73.  
  74.     function reload_querywindow () {
  75.         if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  76.             <?php
  77.             if (!isset($no_history) && (!isset($error_message) || $error_message == '')) {
  78.                 if (isset($LockFromUpdate) && $LockFromUpdate == '1' && isset($sql_query)) {
  79.                     // When the button 'LockFromUpdate' was selected in the querywindow, it does not submit it's contents to
  80.                     // itself. So we create a SQL-history entry here.
  81.                     if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
  82.                         PMA_setHistory((isset($db) ? $db : ''), (isset($table) ? $table : ''), $cfg['Server']['user'], $sql_query);
  83.                     }
  84.                 }
  85.             ?>
  86.             if (!parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate || !parent.frames.queryframe.querywindow.document.sqlform.LockFromUpdate.checked) {
  87.                 parent.frames.queryframe.querywindow.document.querywindow.db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  88.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_db.value = "<?php echo (isset($db) ? addslashes($db) : '') ?>";
  89.                 parent.frames.queryframe.querywindow.document.querywindow.table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  90.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest_table.value = "<?php echo (isset($table) ? addslashes($table) : '') ?>";
  91.  
  92.                 <?php echo (isset($sql_query) ? 'parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = "' . urlencode($sql_query) . '";' : '// no sql query update') . "\n"; ?>
  93.  
  94.                 parent.frames.queryframe.querywindow.document.querywindow.submit();
  95.             }
  96.             <?php
  97.             } else {
  98.             ?>
  99.             // no submit, query was invalid
  100.             <?php
  101.             }
  102.             ?>
  103.         }
  104.     }
  105.  
  106.     function focus_querywindow(sql_query) {
  107.         if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  108.             if (parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab != 'sql') {
  109.                 parent.frames.queryframe.querywindow.document.querywindow.querydisplay_tab.value = "sql";
  110.                 parent.frames.queryframe.querywindow.document.querywindow.query_history_latest.value = sql_query;
  111.                 parent.frames.queryframe.querywindow.document.querywindow.submit();
  112.                 parent.frames.queryframe.querywindow.focus();
  113.             } else {
  114.                 parent.frames.queryframe.querywindow.focus();
  115.             }
  116.  
  117.             return false;
  118.         } else if (parent.frames.queryframe) {
  119.             new_win_url = 'querywindow.php?sql_query=' + sql_query + '&<?php echo PMA_generate_common_url(isset($db) ? addslashes($db) : '', isset($table) ? addslashes($table) : '', '&'); ?>';
  120.             parent.frames.queryframe.querywindow=window.open(new_win_url, '','toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width=<?php echo $cfg['QueryWindowWidth']; ?>,height=<?php echo $cfg['QueryWindowHeight']; ?>');
  121.  
  122.             if (!parent.frames.queryframe.querywindow.opener) {
  123.                parent.frames.queryframe.querywindow.opener = parent.frames.queryframe;
  124.             }
  125.  
  126.             // reload_querywindow();
  127.             return false;
  128.         }
  129.     }
  130.  
  131.     reload_querywindow();
  132. <?php
  133. if (isset($focus_querywindow) && $focus_querywindow == "true") {
  134. ?>
  135.     if (parent.frames.queryframe && parent.frames.queryframe.querywindow && !parent.frames.queryframe.querywindow.closed && parent.frames.queryframe.querywindow.location) {
  136.         self.focus();
  137.     }
  138. <?php
  139. }
  140. ?>
  141.  
  142. //-->
  143. </script>
  144. <?php
  145. }
  146.  
  147.  
  148. /**
  149.  * Close database connections
  150.  */
  151. if (isset($GLOBALS['dbh']) && $GLOBALS['dbh']) {
  152.     @PMA_DBI_close($GLOBALS['dbh']);
  153. }
  154. if (isset($GLOBALS['userlink']) && $GLOBALS['userlink']) {
  155.     @PMA_DBI_close($GLOBALS['userlink']);
  156. }
  157. ?>
  158.  
  159. <?php include('./config.footer.inc.php'); ?>
  160.     <script type="text/javascript" language="javascript" src="libraries/tooltip.js"></script>
  161. </body>
  162.  
  163. </html>
  164. <?php
  165.  
  166. /**
  167.  * Generates profiling data if requested
  168.  */
  169. if (isset($GLOBALS['cfg']['DBG']['enable'])
  170.         && $GLOBALS['cfg']['DBG']['enable']
  171.         && isset($GLOBALS['cfg']['DBG']['profile']['enable'])
  172.         && $GLOBALS['cfg']['DBG']['profile']['enable']) {
  173.     //run the basic setup code first
  174.     require_once('./libraries/dbg/setup.php');
  175.     //if the setup ran fine, then do the profiling
  176.     if (isset($GLOBALS['DBG']) && $GLOBALS['DBG']) {
  177.         require_once('./libraries/dbg/profiling.php');
  178.         dbg_dump_profiling_results();
  179.     }
  180. }
  181.  
  182. /**
  183.  * Sends bufferized data
  184.  */
  185. if (isset($GLOBALS['cfg']['OBGzip']) && $GLOBALS['cfg']['OBGzip']
  186.         && isset($GLOBALS['ob_mode']) && $GLOBALS['ob_mode']) {
  187.     PMA_outBufferPost($GLOBALS['ob_mode']);
  188. }
  189.  
  190. /**
  191.  * Stops the script execution
  192.  */
  193. exit;
  194.  
  195. ?>
  196.